#!/usr/bin/python
#coding=utf8
import MySQLdb
conn = MySQLdb.connect(host="localhost", user="root", passwd="123456", db="test", charset='utf8')
cursor = conn.cursor()
sql = "insert into python(name) values(%s)" 
param = ('test');
cursor.execute(sql,param)
conn.commit()
cursor.execute("select * from python order by id desc")
res = cursor.fetchall()
print "id\tname\n"
for row in res:
    print str(row[0])+"\t"+row[1]+"\n"
cursor.close()
conn.close()
